

# info1 = "D:\tools\noco"
# info2 = r"D:\tools\noco"
# info3 = "D:\\tools\\noco"
# info4 = '张三说："你很厉害"'
# print(info1) # 字符串中有转义字符，不能原样输出
# print(info2)
# print(info3)
# print(info4)



# info = "abcdefg"
# # 获取字母d
# print(info[3])
# # print(info[‐4])
# # 2.通过元素找位置（下标）
# # 字母e在哪个位置？
# print(info.find("e"))
# # 字母k在哪个位置？
# print(info.find("k")) # 如果找不到返回‐1


# info = "爱尔兰共和国"
# # 使用字符串（替换）
# info1 = info.replace("爱尔兰","莫斯科")
# print(info1)
# print(info)



# info = ['Python', 'Java', 'http']
# num = [11, 22, 33]
# # 连接
# info1 = " and ".join(info)
# print(info1)
# print(type(info1))


# sql = "SelECt * from students where id = 001;"
#
# print(sql.split()) # 结果类型是列表
# # 每个单词打印出来
# for i in sql.split():
#     print(i)
# #where拆分出来
# print(sql.split("where"))


# phone = " 13800000001 "
# print(phone)
# print(phone.strip())# 1.去除字符串两头的空格
#
# # 2.大小写转换
# # 转大写：字符串.upper()
# # 转小写：字符串.lower()
# # 定义SQL语句变量
# sql = "SelECt * from students where id = 001;"
# # 判断是否是查询（select是否存在）
# if "select" in sql.lower():
#     print("显示查询结果")
# else:
#     print("非查询")




# # 提示用户输入手机号，并使用 .strip() 去除前后空格
# username = input("请输入手机号：").strip()
#
# # 提示用户输入密码，并去除前后空格
# password = input("请输入密码：").strip()
#
# # 提示用户输入验证码，并去除前后空格
# code = input("请输入验证码：").strip()
#
# # 判断手机号是否为空（用户只输入空格或直接回车）
# if username == "":
#     print("手机号不能为空")
#
# # 判断密码是否为空
# if password == "":
#     print("密码不能为空")
#
# # 判断验证码是否为空
# if code == "":
#     print("验证码不能为空")
#
# # 判断手机号长度是否为11位，且是否全部由数字组成
# if len(username) != 11 or not (username.isdigit()):
#     print("手机号格式不正确")
#
# # 判断验证码是否正确（不区分大小写）
# if code.lower() != "8888":
#     print("验证码错误")
#
# # 判断手机号是否为系统中注册的手机号（模拟账号存在性验证）
# if username != "13488888888":
#     print("手机号不存在")
#
# # 判断密码是否正确
# if password != "123456":
#     print("密码错误")
#
# # 最终判断：只有当手机号、密码、验证码全部正确时，才登录成功
# if username == "13488888888" and password == "123456" and code == "8888":
#     print("登录成功")


# # 定义空列表
# info = []
# info1 = list()
# print(info)
# print(info1)
# # 定义非空列表
# info2 = [11, "aaa", 1.88]
# print(info2)



# # 定义列表
# data_list = ['python', 'java', 'python', 'php']
# # 统计python出现的次数
# num = data_list.count("python")
# print(num) # 次数：2
# # 统计java出现次数
# print(data_list.count("java")) # 次数：1
# print(data_list.count("C++")) # 次数：0



# # 定义列表
# val_list = ["Web自动化", "UI自动化", "接口自动化"]
# val_list.insert(1,"APP自动化")
#
# print(val_list)
#
# val_list.insert(6,"java")
# print(val_list)


# # 定义列表
# val_list = ['Web自动化', 'APP自动化', 'UI自动化', '接口自动化', 'java']
#
# val_list.pop(2)
#
# print(val_list)
#
# val_list.pop()
# print(val_list)
#
# val_list.pop(7)
# print(val_list)



# # 定义列表
# val_list = ['Web自动化', 'APP自动化', 'java', 'UI自动化', '接口自动化', 'java']
# # 删除：“APP自动化”
# val_list.remove('APP自动化')
# # 查看原有列表
# print(val_list)
# # 删除：java
# val_list.remove('java')
# print(val_list)
# # 删除：python
# val_list.remove("python")




# # 定义列表
# val_list = ["Web自动化", "UI自动化", "接口自动化", "APP自动化"]
# # 把UI自动化修改为性能自动化
# val_list[1] = "性能自动化"
#
# print(val_list)
#
# val_list[5] = "python"



# # 定义列表
# info = [8, 100, 30, 10, 40, 2]
# # 反转
# info.reverse()
# # 查看原有列表
# print(info) # [2, 40, 10, 30, 100, 8]



# # 定义列表
# info = [8, 100, 30, 10, 40, 2]
# # 从小到大排序
# info.sort()
# info.sort(reverse=False)
# # 查看原有列表
# print(info)
# # 从大到小排序
# info.sort(reverse=True)
# print(info)



# # 定义列表
#
# student_list = [["张三", "18", "功能测试"], ["李四", "20", "自动化测试"], ["王五", "22",
# ["python", "java"]]]
#
# print(student_list[0])
# aa = student_list[0]
# print(aa[1]) # 18
# # 合并
# print(student_list[0][1])
# # 查找李四
# print(student_list[1][0])
# # 查找java
# print(student_list[2][2][1])




# login_data = [
# ["13488888888", "123456", "8888"],
# ["13488888888", "666666", "8888"],
# ["13488888880", "123456", "8888"],
# ["13488888888", "123456", "0000"]
# ]
# # 遍历
# for i in login_data:
# # print(i) # 每一个中括号的数据 ，i = ["13488888888", "123456", "8888"]
# # 判断手机号和密码
#     if i[0] == "13488888888" and i[1] == "123456":
# # 判断验证码
#         if i[2] == "8888":
#             print("登录成功")
#         else:
#             print("验证码错误")
# else:
#     print("用户名或密码错误")



# # 定义空元组
# info = ()
# info1 = tuple()
# print(info)
# print(info1)
# # 非空
# info2 = (11, 22, 33, 44)
# print(info2)
# # 单个元素
# info3 = ("55",)
# print(type(info3))
# # 不写括号
# info4 = 1, 2, 3, 4
# print(type(info4))



#
# # 定义元组
# info = (11, "aaa", 1.88)
# # 查看下标为2对应元素
# print(info[2]) # 1.88
# # 查看下标为4对应元素
# print(info[4])



# # 定义空字典
# info = {}
# info1 = dict()
# print(type(info), type(info1))
# print(info)
# # 非空字典
# info2 = {"name": "张三", "age": 22, "height": 1.88}
# print(info2)
# print(type(info2))



# # 定义非空字典
# info = {"name": "张三"}
# # 将张三修改为李四
# info["name"] = "李四"
# # 查看原有字典
# print(info) # {'name': '李四'}
# # 增加年龄为22岁
# info["age"] = 22
# # 查看原有字典
# print(info)



# # 定义字典
# info = {'name': '李四', 'age': 22}
# # 删除年龄22
# info.pop("age")
# # 查看原来字典
# print(info)
# # 删除性别
# info.pop("sex")





# # 定义非空字典
# info = {
# "name": "tom",
# "age": 18,
# "gender": "男",
# "hobby": {"read": "小说", "sport": ["篮球", "足球"]}
# }
# # 查询年龄
#
# print(info["age"])
# a2 = info.get("age")
# print(a2)
# print(info.get("age"))
# # 查询键aa的值
# # print(info["aa"])
# # print(info.get("aa")) # None 表示aa键不存在
#
# a1 = info["hobby"]
# print(a1) # {'read': '小说', 'sport': ['篮球', '足球']}
# print(a1["sport"]) # ['篮球', '足球']
# print(a1["sport"][1])
#
# print(info["hobby"]["sport"][1])
# print(info.get("hobby").get("sport")[1])




# # 定义非空字典
# info = {
# "name": "tom",
# "age": 18,
# "gender": "男"
# }
# # 遍历获取字典中所有键
# for i in info.keys():
#     print(f"字典的键是：{i}")
# # 遍历获取字典中所有值
# for i in info.values():
#     print(f"字典的值是：{i}")
# # 遍历获取字典的键和值
# for k, v in info.items():
#     print(f"{k} = {v}")







# # 1.定义空集合
# info = set()
# print(info)
# # 2.集合中添加元素："a"
# info.add("a")
# info.add("b")
# print(info)
# # 定义非空字符串
# var = "abcdeabdcdf"
# # 3.打印非重复的元素
# print(set(var))
# tmp = list(set(var))
# tmp.sort()
# print(tmp)
# print("".join(tmp))


# name = "zxcvasdf"
#
# print(name[2:5])
# print(name[:5])
# print(name[-5:])
# print(name[::2])
# print(name[::-1])
# print(name[-1:])
# print(name[::2])
# print(name[::-1])
# print(name[::3])
# print(name[-6:-3:3])
# print(name[-6:-3])
# print(name[0:5:2])


# info = "abcdefghijklmn"
# info1 = "Hello Python"
#
# print(len(info))
# print(len(info1))
#
# info2 = [1, 2, "a", "b", 1.99]
# print(len(info2))
#
# info3 = (1, 2, "a", "b", 1.99)
# print(len(info3))
#
# info4 = {"a": 1, "b": 2}
# info4.clear()
# print(len(info4))



login_data1 = [
["13800000001", "123456", "8888", "登录成功"],
["13800000001", "1234", "8888", "密码错误"],
["13800000001", "123456", "0000", "验证码错误"]
]
# 定义变量：元组
login_data2 = (
("13800000001", "123456", "8888", "登录成功"),
("13800000001", "1234", "8888", "密码错误"),
("13800000001", "123456", "0000", "验证码错误")
)
# 定义变量：列表元组
login_data3 = [
("13800000001", "123456", "8888", "登录成功"),
("13800000001", "1234", "8888", "密码错误"),
("13800000001", "123456", "0000", "验证码错误")
]
# 定义变量：列表字典
login_data4 = [
{"username": "13800000001", "password": "123456", "code": "8888", "result": "登录成功"},
{"username": "13800000001", "password": "666666", "code": "8888", "result": "密码错误"},
{"username": "13800000001", "password": "123456", "code": "0000", "result": "验证码错误"}]

for j in login_data3:
    print(f"用户名:{j[0]} 密码:{j[1]} 验证码:{j[2]} 期望结果:{j[3]}")
print("\n-------------")
for i in login_data4:
    print(f"用户名：{i.get('username')} 密码：{i.get('password')} 验证码：{i.get('code')} 期望结果:{i.get('result')}")

print("\n-------------")
for case in login_data1:
    print(f"用户名:{case[0]} 密码:{case[1]} 验证码:{case[2]} 期望结果:{case[3]}")

print("\n-------------")
for case in login_data2:
    print(f"用户名:{case[0]} 密码:{case[1]} 验证码:{case[2]} 期望结果:{case[3]}")





















